Image

@Serializable
@SerialName(value = "image")
data class Image(val mediaType: String, val base64: String = "", val providerMetadata: Map<String, JsonElement>? = null, val url: String? = null) : ContentPart

Image content — distinct from generic File so multimodal models (vision providers, image-generation tools) get a typed variant. Per historical parity gap #39, mirrors v6's ImagePart. mediaType is the MIME type (e.g. image/png); base64 is the raw image bytes encoded.

On-device targets (Gemma 4 E2B text-only for now) never emit this — added for forward parity with v6 multimodal providers the port might back later (vision-capable LiteRT-LM bundles, cloud Anthropic / OpenAI).

Constructors

Link copied to clipboard
constructor(mediaType: String, base64: String = "", providerMetadata: Map<String, JsonElement>? = null, url: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val ContentPart.metadata: Map<String, JsonElement>?
Link copied to clipboard
val providerMetadata: Map<String, JsonElement>?
Link copied to clipboard
val url: String?

Remote (or data) URL for the image, when not provided inline as base64. Mirrors v6's image: DataContent | URL. Resolve with convertToLanguageModelPrompt for providers that don't accept URLs.

Functions

Link copied to clipboard
inline fun <T> ContentPart.providerMetadataAs(provider: String): T?
fun <T> ContentPart.providerMetadataAs(provider: String, serializer: KSerializer<T>): T?